Page({

  /**
   * 页面的初始数据
   */
  data: {

    swiperCurrent: 0,

    indicatorDots: true,

    autoplay: true,

    interval: 3000,

    duration: 800,

    circular: true,

    imgUrls: [

      '/images/index/door_left.jpg',
      '/images/index/bell.jpg',
      '/images/index/door_right.jpg',

    ],

    links: [

      '../user/user',

      '../user/user',

      '../user/user'

    ],
    obj: [

      {

        id: 0,

        items: [


          { id: 0, src: '/images/index/jiaoyi.png', text: '闲品交易' },


          { id: 1, src: '/images/index/shiwu.png', text: '失物招领' },

        ],

      }, {

        id: 1,

        items: [


          { id: 3, src: '/images/index/jianzhi.png', text: '兼职信息' },

          { id: 4, src: '/images/index/cengke.png', text: '课程查询' },

        ]

      }
    ]



  },

  //轮播图的切换事件

  swiperChange: function (e) {

    this.setData({

      swiperCurrent: e.detail.current

    })

  },

  //点击指示点切换

  chuangEvent: function (e) {

    this.setData({

      swiperCurrent: e.currentTarget.id

    })

  },

  //点击图片触发事件

  swipclick: function (e) {

    console.log(this.data.swiperCurrent);

    wx.switchTab({

      url: this.data.links[this.data.swiperCurrent]

    })

  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    
  },

  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () {
    
  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {
    
  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function () {
    
  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function () {
    
  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function () {
    
  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function () {
    
  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function () {

  },

  toBranch:function(e){
    var that = this;
    var name = e.currentTarget.dataset.name;
    if(name=="闲品交易"){
      wx.navigateTo({
        url: '/pages/goods/goodsList/goodsList',
      })
    }else if(name=="失物招领"){
      wx.navigateTo({
        url: '/pages/lost/lostList/lostList',
      })
    }else if(name=="兼职信息"){
      wx.navigateTo({
        url: '/pages/parttime/list/list',
      })
    }else if(name=="课程查询"){
      wx.navigateTo({
        url: '/pages/course/course',
      })
    }
    console.log(name);

  }
})